<template>
  <div class="console-console">
    <el-row :gutter="20" class="height">
      <el-col class="height100" :span="8">
        <div class="flex">
          <div class="img">
            <img src="@/assets/pic/leiji.png" alt="">
          </div>
          <div class="jifen">
            <div class="fs24 green">{{ userInfo.points + deduction }}</div>
            <div>累计积分</div>
          </div>
        </div>
      </el-col>
      <el-col class="height100" :span="8">
        <div class="flex">
          <div class="img">
            <img src="@/assets/pic/yue.png" alt="">
          </div>
          <div class="jifen">
            <div class="fs24 red">{{ userInfo.points }}</div>
            <div>积分余额</div>
          </div>
        </div>
      </el-col>
      <el-col class="height100" :span="8">
        <div class="flex">
          <div class="img">
            <img src="@/assets/pic/kouchu.png" alt="">
          </div>
          <div class="jifen">
            <div class="fs24 blue">{{ deduction }}</div>
            <div>扣除积分</div>
          </div>
        </div>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="24">
        <h3>积分流水列表</h3>
      </el-col>
      <el-col :span="24">
        <el-table
          :data="tableData"
          :max-height="500"
          :header-cell-style="{'background-color': '#eef1ff','color': '#2c2c2c'}"
          style="width: 100%">
          <el-table-column
            prop="create_time"
            label="时间">
          </el-table-column>
          <el-table-column
            prop="value"
            label="数额">
          </el-table-column>
          <el-table-column
            prop="scene"
            label="余额">
          </el-table-column>
          <el-table-column
            prop="remark"
            label="描述">
          </el-table-column>
          <el-table-column
            prop="describe"
            label="相关信息">
          </el-table-column>
        </el-table>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { pointsList } from "@/api/example";
export default {
  name: 'Console',
  data(){
    return {
      userInfo: {},
      balanceInfo: {},
      growthValue: 12,
      stitsInfo: {},
      vipValue: 500,
      deduction: 394,
      tableData: []
    }
  },
  computed: {
    key() {
      return this.$route.path
    },
    ...mapGetters([
      'name'
    ])
  },
  mounted(){
    this.userInfo = JSON.parse(sessionStorage.getItem('userInfo'))
    this.getPointsList()
  },
  methods: {
    getPointsList () {
      pointsList().then(res => {
        console.log(res)
        this.tableData = res.data.list.data
      })
    },
    recharge() {
      this.$router.push('/console/account/recharge')
    },
    withdrawal() {
      this.$router.push('/console/account/withdrawal')
    },
    goGoods() {
      this.$router.push('/market-cloud/index')
    },
    goAccount() {
      this.$router.push('/console/account/index')
    },
    goCoupon() {
      this.$router.push('/console/account/coupon')
    }
  }
}
</script>

<style lang="scss" scoped>
.console-console {
  padding: 21px 22px;
  font-size: 14px;
}
.avatar {
  width: 7%;
  margin-right: 2%;
  img {
    width: 100%;
  }
}


.green {
  color: #FEB164;
}
.red {
  color: #F8714E;
}
.blue {
  color: #64A1FC;
}
.height {
  height: 150px;
  display: flex;
  align-items: center;
  padding: 30px 0 20px 0;
  .height100:nth-child(2) {
    border-left: 1px solid #A0B1FF;
    border-right: 1px solid #A0B1FF;
  }
  .height100 {
    height: 100%;
  }
  .flex {
    height: 100%;
    padding-left: 100px;
    display: flex;
    align-items: center;
    .img {
      margin-right: 15px;
    }
  }
}
.fs24 {
  font-size: 24px;
  font-weight: bold;
}
.right {
  span {
    font-size: 20px;
    color: #399fce;
  }
}


</style>

